#include "EquationSolver.h"
using namespace std;

class Func : public Function
{
public:
    double operator()(double _x);
    double diff(double _x);
};

//定义函数
double Func::operator()(double _x){
    double f;
    f = _x - tan(_x);
    return f;
}

//定义函数对应的导数
double Func::diff(double _x){
    double f;
    f = 1 - 1/pow(cos(_x),2);
    return f;
}

int main(int argc,char *argv [ ]){
    cout << "C:" << endl;
    Func func;
    Newton newton1(4.5, eps, 15, func);
    Newton newton2(7.7, eps, 15, func);
    double root1 = newton1.solve(), root2 = newton2.solve();
    cout << "The roots around 4.5 and 7.7 are: " << root1 << ' ' << root2 << endl;
    return 0;
}
